/**
 * Created by yubaolin on 2017/9/23.
 */
const telephoneRegex = /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/
export default {
  getRule (type, message) {
    let rule = {...this[type]}
    rule.message = message
    return rule
  },
  required: {required: true, message: '不能为空', trigger: 'blur'},
  number_min_1: {type: 'number', min: 1, message: '不能为空'},
  max_60: {type: 'string', max: 60, message: '最多输入60个字符', trigger: 'blur'},
  max_100: {type: 'string', max: 100, message: '最多输入100个字符', trigger: 'blur'},
  max_200: {type: 'string', max: 200, message: '最多输入200个字符', trigger: 'blur'},
  telephone: {type: 'string', pattern: telephoneRegex, message: '电话号码格式不对', trigger: 'blur'}
}
